import publicForm from "@/components/public/el-form.vue"; //弹框form
import formJs from "./regexDetail.js"; //新增弹框配置项
import echarts from "@/components/machineNetworkManage/pressDataMonitor/echarts.vue"; //弹框form
// import customDialog from "@/components/commonPublic/processVideo/index.vue"; //弹框form

import {
    getTestHntFlexuralByFid, //详情
} from "@/api/machineNetworkManage/request.js";
export default {
    props: [
        // "dialogVisible",
        // "dialogTitle",
        // "statusNum",
        // "currentRow",
        // "tableTitle"
    ],

    data() {
        return {
            visible: "",
            loading: false,
            // 过程视频弹框
            processVideoRow: {},
            processVideoShow: false,
            formDataVideo: null,

            title: null,
            isLock: false,
            dialogHeight: null,
            formObj: formJs.formObj,
            treeData: [], //材料种类
            currentDetail: null,
            tableObj: [{
                    lable: "样品/见证编号",
                    value: "fSamplenostr",
                    key: "",
                    row: "50%"
                },
                {
                    lable: "试验日期",
                    value: "fTestdates",
                    key: "",
                    row: "50%"
                },
                {
                    lable: "强度等级",
                    value: "fStrength",
                    key: "",
                    row: "50%"
                },
                {
                    lable: "龄期(d)",
                    value: "fAge",
                    key: "",
                    row: "50%"
                },
                {
                    lable: "试验尺寸",
                    value: "fSpecimensize",
                    key: "",
                    row: "50%"
                },
                {
                    lable: "",
                    value: "",
                    key: "",
                    row: "50%"
                },
                {
                    lable: "工程部位及用途",
                    value: "fProjectlocation",
                    key: "",
                    row: "100%"
                },


            ],
            tableData: [{
                lable: "试件编号",
                value: "fTestid",
                key: "",
                row: "33%"
            }, {
                lable: "荷载(kN)",
                value: "fKlhz",
                key: "",
                row: "33%"
            }, {
                lable: "强度(MPa)",
                value: "fKlqd",
                key: "",
                row: "33%"
            }],
            echartsData: null,
            formData: null,
            tableTitle:null
        };
    },
    components: {
        publicForm,
        echarts,
        // customDialog

    },

    created() {
        window.addEventListener("resize", this.getHeight);
        this.getHeight();
    }, //获取页面高度自适应：

    destroyed() {
        window.removeEventListener("resize", this.getHeight);
        this.getHeight();
    },
    mounted() {

        var url = "http://192.168.137.1:8081/#/pressDataMonitor?title=水泥混凝土芯样强度原始采集数据记录&fId=0b327e70-fe71-4281-a296-c2e4591554aa";
        console.log('title', url.split("=")[1].split("&")[0]);
        console.log('url', url.split("=")[2]);
        this.getDetail({
            fId: url.split("=")[2]
        })
        this.tableTitle = url.split("=")[1].split("&")[0];
   
        this.getHeight();
    },
    methods: {
        processVideoClose() {
            this.processVideoShow = false;
        },
        processVideo() {
            this.processVideoShow = true
            // this.$router.push("/processVideo");
            // window.open(this.formDataVideo.fVideo, '_blank')
        },
        getHeight() {
            var h = document.documentElement.clientHeight; //获取页面可见高度
            this.dialogHeight = h * 1 + "px";
        },
        handleSelect(key) {
            this.activeIndex = key;
        },
        closeDialog() {
            this.$emit("close");
        },
        // 详情
        getDetail(obj) {
            this.loading = true;
            getTestHntFlexuralByFid(obj).then((res) => {
                if (res.errcode == 0) {
                    this.loading = false;
                    var data = res.data.yjQmpTestHntflexural
                    this.tableObj.map(item => {
                        var name = item.value
                        item['key'] = data[name]
                    })
                    this.formDataVideo = res.data.yjQmpTestHntflexural
                    this.formData = res.data
                    this.echartsData = res.data.yjQmpTestHntflexuralitems;
                } else {
                    this.loading = false;
                    this.$message.error(res.msg);
                }
            });
        },
    },
};